package innerClass;

public class Outer {
    public int age = 99;
    private static String a;
    public static String schoolName;
    //成员内部类
    public class Inner{
        private String name;
        //public static String schoolName;//JDK 16才开始支持定义静态成员的
        int age = 88;

        public void test(){
            System.out.println(age);
            System.out.println(a);

            int age = 66;
            System.out.println(age);//66
            System.out.println(this.age);//88
            System.out.println(Outer.this.age);//99
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }

    public void test2(){
        System.out.println(age);
        System.out.println(a);
    }
    public static void test3(){
        System.out.println(a);
    }

    public static class Inner2{
        //静态内部类
        private String name;
        public static int a;

        public void test(){
            //可以访问外部类的静态成员，不能访问外部类的实例成员
            System.out.println(schoolName);
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }
}
